package com.wenxixuanwu.fruitstore.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author :小凡凡
 * @version :1.0
 * @Project :fruitstore
 * @Date :2022/4/24
 */
@Configuration
public class UploadConfigure implements WebMvcConfigurer {

    @Value("${BannerSavePath.BannerfileUrl}")
    private String BannerFileUrl; //图标的物理存储路径

    @Value("${BannerSavePath.BannerfileUrlMapper}")
    private String BannerFileUrlMapper; // 图标映射文件

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(BannerFileUrlMapper + "**")
                .addResourceLocations("file:" + BannerFileUrl);
    }
}
